<template>
  <el-table
    :data="tableData"
    border
    style="width: 100%">
    <el-table-column
      prop="id"
      label="ID"
      width="80">
    </el-table-column>
    <el-table-column
      prop="name"
      label="姓名"
      width="100">
    </el-table-column>
    <el-table-column
      prop="phone"
      label="电话"
      width="150">
    </el-table-column>
    <el-table-column
      prop="email"
      label="邮箱"
      width="250">
    </el-table-column>
    <el-table-column
      prop="createTime"
      label="创建时间"
      width="180">
    </el-table-column>
    <el-table-column
      prop="address"
      label="地址">
    </el-table-column>
  </el-table>
</template>

<script>

// 引入axios
// import axios from "axios";

export default {
  name: 'user',
  data () {
    return {
      tableData: []
    }
  },
  mounted() {// 钩子函数 在页面初始化完成后执行
    // 根据Mock接口路径 以及需要的两个参数发送请求
    this.$http.post("/user/list",{"currentPage":1,"pageSize":5}).then(result => {
      // then是接口请求成功返回，result是接口返回参数
      // 将result.data.data分页数据赋值给tableData
      this.tableData = result.data.data;
    }).catch(result => {
      // catch中是接口失败返回
      console.log(result)
    })
  }
}
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>

</style>
